﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;
using System.Diagnostics;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Carto;
using CommonLib;

namespace FormLib
{
    public partial class MainForm : DevExpress.XtraEditors.XtraForm
    {
        private Control m_c = null;
        CommonLib.XMLConfig m_cumtomXMLreadConfig = new CommonLib.XMLConfig("CustomConfig.xml");
        CommonLib.XMLConfig m_DirPathConfig = new CommonLib.XMLConfig("DataPathConfig.xml");
        private Dictionary<string, string> chsNamePairLayerDic;
        /// <summary>
        /// 市区商业基准地价
        /// </summary>
        private string m_sqsydjMxd = "";
        /// <summary>
        /// 市区住宅基准地价
        /// </summary>
        private string m_sqzzdjMxd = "";
        /// <summary>
        /// 市区工业基准地价
        /// </summary>
        private string m_sqgydjMxd = "";
        /// <summary>
        /// 市区商业标定地价
        /// </summary>
        private string m_sqsybddjMxd = "";
        /// <summary>
        /// 市区住宅标定地价
        /// </summary>
        private string m_sqzzbddjMxd = "";
        /// <summary>
        /// 市区工业标定地价
        /// </summary>
        private string m_sqgybddjMxd = "";
        /// <summary>
        /// 市区商业路线地价
        /// </summary>
        private string m_sqsylxdjMxd = "";
        /// <summary>
        /// 合水镇地价
        /// </summary>
        private string m_hszdjMxd = "";
        /// <summary>
        /// 怀乡镇地价
        /// </summary>
        private string m_hxzdjMxd = "";
        /// <summary>
        /// 镇隆镇地价
        /// </summary>
        private string m_zlzdjMxd = "";
        /// <summary>
        /// 其他乡镇地价
        /// </summary>
        private string m_otherdjMxd = "";
        private string m_currMxd = "";

        public MainForm()
        {
            InitializeComponent();
            this.pnlStatus.Controls.Add(this.mapViewer1.lblTips);
            this.mapViewer1.lblTips.Text = " 就绪";
            this.mapViewer1.lblTips.Dock = DockStyle.Left;
            this.pnlStatus.Controls.Add(this.mapViewer1.lblScaleInfo);
            this.mapViewer1.lblScaleInfo.Dock = DockStyle.Right;
            this.pnlStatus.Controls.Add(this.mapViewer1.lblCurCoors);
            this.mapViewer1.lblCurCoors.Dock = DockStyle.Right;
            this.mapViewer1.dockPnlQueryForm.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            //时间
            timer1.Tick += new EventHandler(RunProc);
            timer1.Enabled = true;
            //初始化菜单
            UserControls.usc_SubMenu_Home subMenuHome = new UserControls.usc_SubMenu_Home();
            m_c = subMenuHome;
            this.pnlSubMenu.Controls.Add(subMenuHome);
            subMenuHome.BringToFront();
            subMenuHome.Dock = DockStyle.Fill;
            subMenuHome.sBtnSubHome.Click += new EventHandler(SBtnHome_Click);
            subMenuHome.sBtnSubQuery.Click += new EventHandler(sBtnQuery_Click);
            subMenuHome.sBtnSubCal.Click += new EventHandler(sBtnCal_Click);
            subMenuHome.sBtnSubData.Click += new EventHandler(sBtnData_Click);
            subMenuHome.sBtnSubUpdate.Click += new EventHandler(sBtnUpdate_Click);
            subMenuHome.sBtnSubSetting.Click += new EventHandler(sBtnSetting_Click);
            //皮肤
            string skinName = m_cumtomXMLreadConfig.GetAttributeValueFromSpcialAttribute("Skin", "name", "CustomSkinName", "value");
            switch (skinName)
            {
                case "Office 2007 蓝色":
                    this.checkEdit07Blue.Checked = true;
                    break;
                case "Office 2007 绿色":
                    this.checkEdit07Green.Checked = true;
                    break;
                case "Office 2010 蓝色":
                    this.checkEdit10Blue.Checked = true;
                    break;
                case "Office 2010 银色":
                    this.checkEdit10Siver.Checked = true;
                    break;
            }

            //工作目录
            List<string> dirPathList = m_DirPathConfig.GetAttributeValueListFromAttributeName("Path", "value");
            List<string> newdirPathList = new List<string>();
            for (int i = 0; i < dirPathList.Count; i++)
            {
                if (dirPathList[i].ToString().StartsWith("[ApplicationTargetFolder]"))
                {
                    string newPath = dirPathList[i].ToString().Replace("[ApplicationTargetFolder]", ConfigsAllocator.appStartPath);
                    newdirPathList.Add(newPath);
                }
                else
                {
                    newdirPathList.Add(dirPathList[i]);
                }
            }
            this.txtESQSYData.Text = m_sqsydjMxd = newdirPathList[0];
            this.txtESQZZData.Text = m_sqzzdjMxd = newdirPathList[1];
            this.txtESQGYData.Text = m_sqgydjMxd = newdirPathList[2];
            this.txtESQSYBDData.Text = m_sqsybddjMxd = newdirPathList[3];
            this.txtESQSYLXData.Text = m_sqsylxdjMxd = newdirPathList[4];
            this.txtEHSZData.Text = m_hszdjMxd = newdirPathList[5];
            this.txtEHXZData.Text = m_hxzdjMxd = newdirPathList[6];
            this.txtEZLZData.Text = m_zlzdjMxd = newdirPathList[7];
            this.txtEOtherData.Text = m_otherdjMxd = newdirPathList[8];
            this.txtESQZZBDData.Text = m_sqzzbddjMxd = newdirPathList[9];
            this.txtESQGYBDData.Text = m_sqgybddjMxd = newdirPathList[10];
            if (m_sqsydjMxd == "" || m_sqsybddjMxd == "")
            {
                MessageBox.Show("请先配置信宜市有关地价相关数据", "提示");
                sBtnData_Click(null, null);
            }
            else
            {
                m_currMxd = m_sqsydjMxd;
                chsNamePairLayerDic = new Dictionary<string, string>();
                List<string> chsNameList = m_DirPathConfig.GetAttributeValueListFromAttributeName("Path", "chsName");
                List<string> layerNameList = m_DirPathConfig.GetAttributeValueListFromAttributeName("Path", "layer");
                for (int i = 0; i < chsNameList.Count; i++)
                {
                    if (chsNamePairLayerDic.ContainsKey(chsNameList[i])) continue;
                    chsNamePairLayerDic.Add(chsNameList[i], layerNameList[i]);
                    this.cmbLayer.Properties.Items.Add(chsNameList[i]);
                }
                this.cmbLayer.SelectedIndex = 0;
                this.mapViewer1.LoadFile(m_currMxd);//默认加载基准
            }
            Application.DoEvents();
            this.mapViewer1.sBtnExpend_Click(null, null);
        }

        private void RunProc(object sender, EventArgs e)//执行的部分 
        {
            lblCYear.Text = DateTime.Now.Year.ToString("##年");
            lblCTime.Text = DateTime.Now.ToLongTimeString();
            lblCMonth.Text = DateTime.Now.Month.ToString();
            lblCDay.Text = DateTime.Now.Day.ToString();
        }
        #region 菜单

        public void SBtnHome_Click(object sender, EventArgs e)//首页
        {
            if (m_currMxd != m_sqsydjMxd)
            {
                this.mapViewer1.LoadFile(m_currMxd);//默认加载基准
                m_currMxd = m_sqsydjMxd;
            }
            setDefaultButtonStyle();
            this.SBtnHome.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            this.pnlSubMenu.Controls.Remove(m_c);
            UserControls.usc_SubMenu_Home subMenuHome = new UserControls.usc_SubMenu_Home();
            this.pnlSubMenu.Controls.Add(subMenuHome);
            subMenuHome.BringToFront();
            subMenuHome.Dock = DockStyle.Fill;
            m_c = subMenuHome;
            this.mapViewer1.lblScaleInfo.Visible = true;
            this.mapViewer1.lblCurCoors.Visible = true;
            this.xTbcMenu.SelectedTabPageIndex = 0;
            subMenuHome.sBtnSubHome.Click += new EventHandler(SBtnHome_Click);
            subMenuHome.sBtnSubQuery.Click += new EventHandler(sBtnQuery_Click);
            subMenuHome.sBtnSubCal.Click += new EventHandler(sBtnCal_Click);
            subMenuHome.sBtnSellPrice.Click += new EventHandler(sBtnSellPriceCal_Click);
            subMenuHome.sBtnSubData.Click += new EventHandler(sBtnData_Click);
            subMenuHome.sBtnSubUpdate.Click += new EventHandler(sBtnUpdate_Click);
            subMenuHome.sBtnSubSetting.Click += new EventHandler(sBtnSetting_Click);
            this.mapViewer1.lblTips.Text = "首页";
        }

        private void sBtnData_Click(object sender, EventArgs e)//数据配置
        {
            setDefaultButtonStyle();
            this.sBtnData.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            this.mapViewer1.lblScaleInfo.Visible = false;
            this.mapViewer1.lblCurCoors.Visible = false;
            this.xTbcMenu.SelectedTabPageIndex = 1;
            this.mapViewer1.lblTips.Text = "数据配置";

        }

        private void sBtnQuery_Click(object sender, EventArgs e)//查询
        {
            setDefaultButtonStyle();
            this.sBtnQuery.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            this.pnlSubMenu.Controls.Remove(m_c);
            UserControls.usc_SubMenu_Query subMenuQuery = new UserControls.usc_SubMenu_Query();
            this.pnlSubMenu.Controls.Add(subMenuQuery);
            subMenuQuery.BringToFront();
            subMenuQuery.Dock = DockStyle.Fill;
            m_c = subMenuQuery;
            this.mapViewer1.lblScaleInfo.Visible = true;
            this.mapViewer1.lblCurCoors.Visible = true;
            this.xTbcMenu.SelectedTabPageIndex = 0;
            subMenuQuery.nbi_SQ_SYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SQ_SYDJ_LinkClicked);// 市区商业地价查询
            subMenuQuery.nbi_SQ_ZZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SQ_ZZDJ_LinkClicked);//市区住宅地价查询
            subMenuQuery.nbi_SQ_GYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SQ_GYDJ_LinkClicked);//市区工业地价查询
            subMenuQuery.nbi_SQ_SYLXDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SQ_SYLXDJ_LinkClicked);//市区商业路线地价查询
            subMenuQuery.nbi_SQ_SQBD.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SQ_BDDJ_LinkClicked);//市区标定地价查询
            //中心乡镇地价查询
            subMenuQuery.nbi_HSZ_SYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HSZ_DJ_LinkClicked);//合水镇商业地价查询
            subMenuQuery.nbi_HSZ_ZZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HSZ_DJ_LinkClicked);//合水镇住宅地价查询
            subMenuQuery.nbi_HSZ_GYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HSZ_DJ_LinkClicked);//合水镇工业地价查询
            subMenuQuery.nbi_HXZ_SYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HXZ_DJ_LinkClicked);//怀乡镇商业地价查询
            subMenuQuery.nbi_HXZ_ZZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HXZ_DJ_LinkClicked);//怀乡镇住宅地价查询
            subMenuQuery.nbi_HXZ_GYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HXZ_DJ_LinkClicked);//怀乡镇工业地价查询
            subMenuQuery.nbi_ZLZ_SYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZLZ_DJ_LinkClicked);//镇隆镇商业地价查询
            subMenuQuery.nbi_ZLZ_ZZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZLZ_DJ_LinkClicked);//镇隆镇住宅地价查询
            subMenuQuery.nbi_ZLZ_GYDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZLZ_DJ_LinkClicked);//镇隆镇工业地价查询
            //其他乡镇地价查询
            subMenuQuery.nbi_QTZ_ZHDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_Other_DJ_LinkClicked);//其他地价查询
            this.mapViewer1.lblTips.Text = "查询";

        }

        private void sBtnCal_Click(object sender, EventArgs e)//测算
        {
            setDefaultButtonStyle();
            this.sBtnCal.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            this.pnlSubMenu.Controls.Remove(m_c);
            UserControls.usc_SubMenu_Cal subMenuCal = new UserControls.usc_SubMenu_Cal();
            this.pnlSubMenu.Controls.Add(subMenuCal);
            subMenuCal.BringToFront();
            subMenuCal.Dock = DockStyle.Fill;
            m_c = subMenuCal;
            this.mapViewer1.lblScaleInfo.Visible = true;
            this.mapViewer1.lblCurCoors.Visible = true;
            this.xTbcMenu.SelectedTabPageIndex = 0;
            //按基准测算
            subMenuCal.nbi_SY_ZDDJ_JZ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SY_ZDDJ_JZ_LinkClicked);//市区商业宗地按基准
            subMenuCal.nbi_ZZ_ZDDJ_JZ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZZ_ZDDJ_JZ_LinkClicked);
            subMenuCal.nbi_GY_ZDDJ_JZ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_GY_ZDDJ_JZ_LinkClicked);
            //按标定测算
            subMenuCal.nbi_SY_ZDDJ_BD.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZDDJ_BD_LinkClicked);
            subMenuCal.nbi_ZZ_ZDDJ_BD.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZDDJ_BD_LinkClicked);
            subMenuCal.nbi_GY_ZDDJ_BD.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZDDJ_BD_LinkClicked);

            //乡镇宗地价格测算
            subMenuCal.nbi_HSZ_RegionAreaPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HSZ_RegionAreaPrice_LinkClicked);
            subMenuCal.nbi_HXZ_RegionAreaPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_HXZ_RegionAreaPrice_LinkClicked);
            subMenuCal.nbi_ZLZ_RegionAreaPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZLZ_RegionAreaPrice_LinkClicked); ;
            subMenuCal.nbi_Other_RegionAreaPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_Other_RegionAreaPrice_LinkClicked);
            this.mapViewer1.lblTips.Text = "测算";

        }

        private void sBtnSellPriceCal_Click(object sender, EventArgs e)//出让价格测算
        {
            setDefaultButtonStyle();
            this.sBtnSellPriceCal.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            this.pnlSubMenu.Controls.Remove(m_c);
            UserControls.usc_SubMenu_SellPriceCal subMenuSellPriceCal = new UserControls.usc_SubMenu_SellPriceCal();
            this.pnlSubMenu.Controls.Add(subMenuSellPriceCal);
            subMenuSellPriceCal.BringToFront();
            subMenuSellPriceCal.Dock = DockStyle.Fill;
            m_c = subMenuSellPriceCal;
            this.mapViewer1.lblScaleInfo.Visible = true;
            this.mapViewer1.lblCurCoors.Visible = true;
            this.xTbcMenu.SelectedTabPageIndex = 0;
            //市区出让
            subMenuSellPriceCal.nbi_SY_CitySellPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SY_CitySellPrice_LinkClicked);
            subMenuSellPriceCal.nbi_ZZ_CitySellPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SY_CitySellPrice_LinkClicked);
            subMenuSellPriceCal.nbi_GY_CitySellPrice.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SY_CitySellPrice_LinkClicked);
            this.mapViewer1.lblTips.Text = "出让价格测算";

        }

        private void sBtnUpdate_Click(object sender, EventArgs e)//更新
        {
            setDefaultButtonStyle();
            this.sBtnUpdate.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            this.pnlSubMenu.Controls.Remove(m_c);
            UserControls.usc_SubMenu_Update subMenuUpdate = new UserControls.usc_SubMenu_Update();
            this.pnlSubMenu.Controls.Add(subMenuUpdate);
            subMenuUpdate.BringToFront();
            subMenuUpdate.Dock = DockStyle.Fill;
            m_c = subMenuUpdate;
            this.mapViewer1.lblScaleInfo.Visible = true;
            this.mapViewer1.lblCurCoors.Visible = true;
            this.xTbcMenu.SelectedTabPageIndex = 0;
            subMenuUpdate.nbi_SY_JZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_SY_JZDJ_LinkClicked);// 市区商业地价查询
            subMenuUpdate.nbi_ZZ_JZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_ZZ_JZDJ_LinkClicked);//市区住宅地价查询
            subMenuUpdate.nbi_GY_JZDJ.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(nbi_GY_JZDJ_LinkClicked);//市区工业地价查询
            this.mapViewer1.lblTips.Text = "更新";

        }

        private void sBtnSetting_Click(object sender, EventArgs e)//设置
        {
            setDefaultButtonStyle();
            this.sBtnSetting.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.Flat;
            if (this.gpbabout.Controls.Count == 0)
            {
                UserControls.usc_about about = new UserControls.usc_about();
                about.BringToFront();
                about.Dock = DockStyle.Fill;
                this.gpbabout.Controls.Add(about);
            }
            this.mapViewer1.lblScaleInfo.Visible = false;
            this.mapViewer1.lblCurCoors.Visible = false;
            this.xTbcMenu.SelectedTabPageIndex = 2;
            this.mapViewer1.lblTips.Text = "设置";
        }
        //按键样式还原
        private void setDefaultButtonStyle()
        {
            this.SBtnHome.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
            this.sBtnData.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
            this.sBtnQuery.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
            this.sBtnCal.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
            this.sBtnSellPriceCal.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
            this.sBtnUpdate.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
            this.sBtnSetting.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
        }
        #endregion

        #region 查询
        /// <summary>市区商业基准地价查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SQ_SYDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区商业基准地价查询";
            //将地图窗口的地图切换到市区商业基准地价mxd;
            swithMap(m_currMxd, m_sqsydjMxd, "市区商业基准地价数据");

            //if (m_currMxd != m_sqsydjMxd)
            //{
            //    if (m_sqsydjMxd == "")
            //    {
            //        MessageBox.Show("市区商业基准地价数据未配置！");
            //        return;
            //    }
            //    this.mapViewer1.LoadFile(m_sqsydjMxd);//默认加载基准
            //    m_currMxd = m_sqsydjMxd;
            //}
            //执行点击选择地图方格，弹出查询窗口的方式。


            //获取宗地图层名
            string XmlNode = "mxds/mxd[@name='商业级别价']/layer[@name='商业宗地']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 10001;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>市区住宅基准地价查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SQ_ZZDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区住宅基准地价查询";
            //将地图窗口的地图切换到市区住宅基准地价mxd;
            if (m_currMxd != m_sqzzdjMxd)
            {
                if (m_sqzzdjMxd == "")
                {
                    MessageBox.Show("市区住宅基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqzzdjMxd);//默认加载基准
                m_currMxd = m_sqzzdjMxd;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。


            //获取宗地图层名
            string XmlNode = "mxds/mxd[@name='住宅级别价']/layer[@name='住宅宗地']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQZZData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 10002;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>市区工业基准地价查询
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SQ_GYDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区工业基准地价查询";
            //将地图窗口的地图切换到市区工业基准地价mxd;
            if (m_currMxd != m_sqgydjMxd)
            {
                if (m_sqgydjMxd == "")
                {
                    MessageBox.Show("市区工业基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqgydjMxd);//默认加载基准
                m_currMxd = m_sqgydjMxd;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。


            //获取宗地图层名
            string XmlNode = "mxds/mxd[@name='工业级别价']/layer[@name='工业宗地']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQGYData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 10003;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>市区商业路线基准地价查询
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SQ_SYLXDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区商业路线基准地价查询";
            //将地图窗口的地图切换到市区商业路线地价mxd;
            if (m_currMxd != m_sqsylxdjMxd)
            {
                if (m_sqsylxdjMxd == "")
                {
                    MessageBox.Show("市区商业路线基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqsylxdjMxd);//默认加载基准
                m_currMxd = m_sqsylxdjMxd;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。

            //获取商业路线价图层名
            string XmlNode = "mxds/mxd[@name='商业路线价']/layer[@name='商业路线价']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYLXData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 10004;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary> 市区标定地价地价查询
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SQ_BDDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区标定地价查询";
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_sqsybddjMxd)
            {
                if (m_sqsybddjMxd == "")
                {
                    MessageBox.Show("市区标定地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqsybddjMxd);//默认加载基准
                m_currMxd = m_sqsybddjMxd;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。

            //获取商业标定地价宗地图层名
            string XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业样点']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 10005;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>合水镇商业、工业、住宅基准地价
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_HSZ_DJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (m_currMxd != m_hszdjMxd)
            {
                if (m_hszdjMxd == "")
                {
                    MessageBox.Show("合水镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_hszdjMxd);//默认加载基准
                m_currMxd = m_hszdjMxd;
            }
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_HSZ_SYDJ":
                    this.mapViewer1.lblTips.Text = " 合水镇商业基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10006;
                    break;
                case "nbi_HSZ_ZZDJ":
                    this.mapViewer1.lblTips.Text = " 合水镇住宅基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10007;
                    break;
                case "nbi_HSZ_GYDJ":
                    this.mapViewer1.lblTips.Text = " 合水镇工业基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10008;
                    break;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEHSZData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>怀乡镇商业、工业、住宅基准地价
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_HXZ_DJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (m_currMxd != m_hxzdjMxd)
            {
                if (m_hxzdjMxd == "")
                {
                    MessageBox.Show("怀乡镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_hxzdjMxd);//默认加载基准
                m_currMxd = m_hxzdjMxd;
            }
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_HXZ_SYDJ":
                    this.mapViewer1.lblTips.Text = " 怀乡镇商业基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10009;
                    break;
                case "nbi_HXZ_ZZDJ":
                    this.mapViewer1.lblTips.Text = " 怀乡镇住宅基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10010;
                    break;
                case "nbi_HXZ_GYDJ":
                    this.mapViewer1.lblTips.Text = " 怀乡镇工业基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10011;
                    break;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEHXZData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>镇隆镇商业、工业、住宅基准地价(乡镇先不管）
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_ZLZ_DJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (m_currMxd != m_zlzdjMxd)
            {
                if (m_zlzdjMxd == "")
                {
                    MessageBox.Show("镇隆镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_zlzdjMxd);//默认加载基准
                m_currMxd = m_zlzdjMxd;
            }
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_ZLZ_SYDJ":
                    this.mapViewer1.lblTips.Text = " 镇隆镇商业基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10012;
                    break;
                case "nbi_ZLZ_ZZDJ":
                    this.mapViewer1.lblTips.Text = " 镇隆镇住宅基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10013;
                    break;
                case "nbi_ZLZ_GYDJ":
                    this.mapViewer1.lblTips.Text = " 镇隆镇工业基准地价查询";
                    CommonLib.CommonTools.MapMouseFlag = 10014;
                    break;
            }
            //执行点击选择地图方格，弹出查询窗口的方式。


            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEZLZData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>其他乡镇商业、工业、住宅基准地价（乡镇先不管）
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_Other_DJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 其他乡镇商业基准地价查询";
            //将地图窗口的地图切换到市区工业基准地价mxd;
            if (m_currMxd != m_otherdjMxd)
            {
                if (m_otherdjMxd == "")
                {
                    MessageBox.Show("其他乡镇商业基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_otherdjMxd);//默认加载基准
                m_currMxd = m_otherdjMxd;
            }
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEOtherData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 10015;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        #endregion

        #region 测算
        /// <summary>市区商业宗地价格按基准地价测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SY_ZDDJ_JZ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区商业宗地价格按基准地价测算";
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_sqsydjMxd)
            {
                if (m_sqsydjMxd == "")
                {
                    MessageBox.Show("市区商业基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqsydjMxd);//默认加载基准
                m_currMxd = m_sqsydjMxd;
            }



            //获取宗地图层名
            string XmlNode = "mxds/mxd[@name='商业级别价']/layer[@name='商业宗地']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 20001;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>市区住宅宗地价格按基准地价测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_ZZ_ZDDJ_JZ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区住宅宗地价格按基准地价测算";
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_sqzzdjMxd)
            {
                if (m_sqzzdjMxd == "")
                {
                    MessageBox.Show("市区住宅基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqzzdjMxd);//默认加载基准
                m_currMxd = m_sqzzdjMxd;
            }


            //获取宗地图层名
            string XmlNode = "mxds/mxd[@name='住宅级别价']/layer[@name='住宅宗地']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQZZData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 20002;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>市区工业宗地价格按基准地价测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_GY_ZDDJ_JZ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            this.mapViewer1.lblTips.Text = " 市区工业宗地价格按基准地价测算";
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_sqgydjMxd)
            {
                if (m_sqgydjMxd == "")
                {
                    MessageBox.Show("市区工业基准地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_sqgydjMxd);//默认加载基准
                m_currMxd = m_sqgydjMxd;
            }


            //获取宗地图层名
            string XmlNode = "mxds/mxd[@name='工业级别价']/layer[@name='工业宗地']";
            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
            CommonLib.AETools.tagetLayerName = layerName;

            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQGYData.Name, "layer");
            CommonLib.CommonTools.MapMouseFlag = 20003;
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>市区商业、住宅、工业宗地价格按标定地价测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_ZDDJ_BD_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {

            //MessageBox.Show("参数缺省中，暂无法按此方法计算！","错误");
            //return;
            #region 未完成

            //this.mapViewer1.lblTips.Text = " 市区商业宗地价格按标定地价测算";
            ////将地图窗口的地图切换到市区标定地价mxd;
            //if (m_currMxd != m_sqbddjMxd)
            //{
            //    if (m_sqbddjMxd == "")
            //    {
            //        MessageBox.Show("市区商业基准地价数据未配置！");
            //        return;
            //    }
            //    this.mapViewer1.LoadFile(m_sqbddjMxd);//默认加载基准
            //    m_currMxd = m_sqbddjMxd;
            //}
            //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "layerName");//宗地图层名
            //CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "layerField");//宗地图层标定地价字段名

            //CommonLib.AETools.YDLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "YDLayerName");//样点图层名
            //CommonLib.AETools.YDLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "YDLayerField");//样点图层标定地价字段名
            //CommonLib.AETools.RJLXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "RJLXZXS");//样点图层修正系数
            //CommonLib.AETools.SYNQXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "SYNQXZXS");//样点图层修正系数
            //CommonLib.AETools.LJSDXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "LJSDXZXS");//样点图层修正系数
            //CommonLib.AETools.KSBXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "KSBXZXS");//样点图层修正系数
            //CommonLib.AETools.ZDXZXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "ZDXZXZXS");//样点图层修正系数
            //CommonLib.AETools.JJDXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "JJDXZXS");//样点图层修正系数
            //CommonLib.AETools.KFCDXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "KFCDXZXS");//样点图层修正系数
            //CommonLib.AETools.EJFLXZXS = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQBDData.Name, "EJFLXZXS");//样点图层修正系数

            //CommonLib.CommonTools.MapMouseFlag = 30001;
            //this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            //this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
            #endregion

            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            string XmlNode = "";
            string layerName = "";
            switch (navBarItem.Name)
            {
                case "nbi_SY_ZDDJ_BD":
                    #region 商业按标定
                    //将地图窗口的地图切换到市区标定地价mxd;
                    if (m_currMxd != m_sqsybddjMxd)
                    {
                        if (m_sqsybddjMxd == "")
                        {
                            MessageBox.Show("市区标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqsybddjMxd);//默认加载基准
                        m_currMxd = m_sqsybddjMxd;
                    }
                    this.mapViewer1.lblTips.Text = " 市区商业宗地价格按标定地价测算";

                    //这里我修改了配置文件，你需自己另外配置个配置文件
                    //MessageBox.Show("配置文件已修改，请另外新建配置文件");

                    //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layerName");//宗地图层名



                    ///获取宗地图层名
                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业宗地']";
                    layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
                    CommonLib.AETools.tagetLayerName = layerName;
                    //获取样点图层
                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业样点']";
                    CommonLib.AETools.YDLayerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");

                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业宗地']/field[@name='标定地价']";
                    CommonLib.AETools.tagetLayerField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");

                    //CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layer");//宗地图层标定地价字段名

                    List<string> syList = XMLConfig.getBDDJInfo("BDDJConfig.xml", "AppConfig/SY");
                    //CommonLib.AETools.YDLayerName = syList[0];//样点图层名
                    CommonLib.AETools.YDLayerField = syList[1];//样点图层标定地价字段名
                    CommonLib.AETools.RJLXZXS = syList[2];//样点图层修正系数
                    CommonLib.AETools.SYNQXZXS = syList[3];//样点图层修正系数
                    CommonLib.AETools.LJSDXZXS = syList[4];//样点图层修正系数
                    CommonLib.AETools.KSBXZXS = syList[5];//样点图层修正系数
                    CommonLib.AETools.ZDXZXZXS = syList[6];//样点图层修正系数
                    CommonLib.AETools.JJDXZXS = syList[7];//样点图层修正系数
                    CommonLib.AETools.KFCDXZXS = syList[8];//样点图层修正系数
                    CommonLib.AETools.EJFLXZXS = syList[9];//样点图层修正系数

                    CommonLib.CommonTools.MapMouseFlag = 30001;
                    this.mapViewer1.axMapControlMainMap.CurrentTool = null;
                    this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
                    #endregion
                    break;
                case "nbi_ZZ_ZDDJ_BD":
                    #region 住宅按标定
                    //将地图窗口的地图切换到市区标定地价mxd;
                    if (m_currMxd != m_sqzzbddjMxd)
                    {
                        if (m_sqsybddjMxd == "")
                        {
                            MessageBox.Show("市区标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqzzbddjMxd);//默认加载基准
                        m_currMxd = m_sqzzbddjMxd;
                    }
                    this.mapViewer1.lblTips.Text = " 市区住宅宗地价格按标定地价测算";

                    //这里我修改了配置文件，你需自己另外配置个配置文件
                    //MessageBox.Show("配置文件已修改，请另外新建配置文件");

                    //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layerName");//宗地图层名



                    //获取宗地图层名
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅宗地']";
                    layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
                    CommonLib.AETools.tagetLayerName = layerName;


                    //获取样点图层
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅样点']";
                    CommonLib.AETools.YDLayerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");

                    //获取标定地价字段
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅宗地']/field[@name='标定地价']";
                    CommonLib.AETools.tagetLayerField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");
                    //CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQZZBDData.Name, "layer");//宗地图层标定地价字段名

                    List<string> zzList = XMLConfig.getBDDJInfo("BDDJConfig.xml", "AppConfig/ZZ");
                    //CommonLib.AETools.YDLayerName = zzList[0];//样点图层名
                    CommonLib.AETools.YDLayerField = zzList[1];//样点图层标定地价字段名
                    CommonLib.AETools.RJLXZXS = zzList[2];//样点图层修正系数
                    CommonLib.AETools.SYNQXZXS = zzList[3];//样点图层修正系数
                    CommonLib.AETools.LJSDXZXS = zzList[4];//样点图层修正系数
                    CommonLib.AETools.KSBXZXS = zzList[5];//样点图层修正系数
                    CommonLib.AETools.ZDXZXZXS = zzList[6];//样点图层修正系数
                    CommonLib.AETools.JJDXZXS = zzList[7];//样点图层修正系数


                    CommonLib.CommonTools.MapMouseFlag = 30002;
                    this.mapViewer1.axMapControlMainMap.CurrentTool = null;
                    this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
                    #endregion
                    break;
                case "nbi_GY_ZDDJ_BD":
                    #region 工业按标定
                    //将地图窗口的地图切换到市区标定地价mxd;
                    if (m_currMxd != m_sqgybddjMxd)
                    {
                        if (m_sqgybddjMxd == "")
                        {
                            MessageBox.Show("市区标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqgybddjMxd);//默认加载基准
                        m_currMxd = m_sqgybddjMxd;
                    }
                    this.mapViewer1.lblTips.Text = " 市区工业宗地价格按标定地价测算";
                    //这里我修改了配置文件，你需自己另外配置个配置文件
                    //MessageBox.Show("配置文件已修改，请另外新建配置文件");

                    //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layerName");//宗地图层名
                    CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQGYBDData.Name, "layer");//宗地图层标定地价字段名



                    //获取宗地图层名
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业宗地']";
                    layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
                    CommonLib.AETools.tagetLayerName = layerName;

                    //获取样点图层
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业样点']";
                    CommonLib.AETools.YDLayerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");

                    //获取标定地价字段
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业宗地']/field[@name='标定地价']";
                    CommonLib.AETools.tagetLayerField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");

                    List<string> gyList = XMLConfig.getBDDJInfo("BDDJConfig.xml", "AppConfig/GY");
                    //CommonLib.AETools.YDLayerName = gyList[0];//样点图层名
                    CommonLib.AETools.YDLayerField = gyList[1];//样点图层标定地价字段名
                    CommonLib.AETools.RJLXZXS = gyList[2];//样点图层修正系数
                    CommonLib.AETools.SYNQXZXS = gyList[3];//样点图层修正系数
                    CommonLib.AETools.LJSDXZXS = gyList[4];//样点图层修正系数



                    CommonLib.CommonTools.MapMouseFlag = 30003;
                    this.mapViewer1.axMapControlMainMap.CurrentTool = null;
                    this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
                    #endregion
                    break;
                default:
                    MessageBox.Show("请选择要测算的功能。");
                    break;
            }
        }

        /// <summary>合水镇商业、住宅、工业宗地出让价格测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_HSZ_RegionAreaPrice_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            //按照市区测算宗地地价的方法计算
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_hszdjMxd)
            {
                if (m_hszdjMxd == "")
                {
                    MessageBox.Show("合水镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_hszdjMxd);//默认加载基准
                m_currMxd = m_hszdjMxd;
            }
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_SY_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 合水镇商业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40001;
                    break;
                case "nbi_ZZ_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 合水镇住宅宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40002;
                    break;
                case "nbi_GY_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 合水镇工业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40003;
                    break;
            }
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEHSZData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>怀乡镇商业、住宅、工业宗地出让价格测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_HXZ_RegionAreaPrice_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            //按照市区测算宗地地价的方法计算
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_hxzdjMxd)
            {
                if (m_hxzdjMxd == "")
                {
                    MessageBox.Show("怀乡镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_hxzdjMxd);//默认加载基准
                m_currMxd = m_hxzdjMxd;
            }
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_SY_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 怀乡镇商业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40004;
                    break;
                case "nbi_ZZ_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 怀乡镇住宅宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40005;
                    break;
                case "nbi_GY_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 怀乡镇工业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40006;
                    break;
            }
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEHXZData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary>镇隆镇商业、住宅、工业宗地出让价格测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_ZLZ_RegionAreaPrice_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            //按照市区测算宗地地价的方法计算
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_zlzdjMxd)
            {
                if (m_zlzdjMxd == "")
                {
                    MessageBox.Show("镇隆镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_zlzdjMxd);//默认加载基准
                m_currMxd = m_zlzdjMxd;
            }
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_SY_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 镇隆镇商业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40007;
                    break;
                case "nbi_ZZ_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 镇隆镇住宅宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40008;
                    break;
                case "nbi_GY_ZDDJ_BD":
                    this.mapViewer1.lblTips.Text = " 镇隆镇工业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 40009;
                    break;
            }
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEZLZData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        /// <summary 其他镇商业、住宅、工业宗地出让价格测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_Other_RegionAreaPrice_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            //按照市区测算宗地地价的方法计算
            //将地图窗口的地图切换到市区标定地价mxd;
            if (m_currMxd != m_otherdjMxd)
            {
                if (m_otherdjMxd == "")
                {
                    MessageBox.Show("其他镇地价数据未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(m_otherdjMxd);//默认加载基准
                m_currMxd = m_otherdjMxd;
            }
            this.mapViewer1.lblTips.Text = " 其他镇工业宗地出让价格测算";
            CommonLib.CommonTools.MapMouseFlag = 40010;
            CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtEOtherData.Name, "layer");
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        #endregion

        #region 出让价格测算
        /// <summary>市区商业、住宅、工业宗地出让价格测算
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SY_CitySellPrice_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            //按照标定地价测算宗地价格后，乘以40%即为宗地出让价格，出让价格的测算时针对的宗地图层的按标定价格测算的宗地价格为基数进行计算的。
            string XmlNode = "";
            string layerName = "";
            DevExpress.XtraNavBar.NavBarItem navBarItem = sender as DevExpress.XtraNavBar.NavBarItem;
            switch (navBarItem.Name)
            {
                case "nbi_SY_CitySellPrice":
                    //切换到相应标定图层
                    /*if (m_currMxd != m_sqsybddjMxd)
                    {
                        if (m_sqsybddjMxd == "")
                        {
                            MessageBox.Show("市区商业标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqsybddjMxd);
                        m_currMxd = m_sqsybddjMxd;
                    }
                    this.mapViewer1.lblTips.Text = " 市区商业宗地出让价格测算";
                    CommonLib.CommonTools.MapMouseFlag = 30004;
                    //TODO：修改目标图层的获取方法，直接通过Key ，Value，由赖泽辉继续完成。
                    CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "value", m_currMxd, "layer");*/
                    #region 商业按标定
                    //将地图窗口的地图切换到市区标定地价mxd;
                    if (m_currMxd != m_sqsybddjMxd)
                    {
                        if (m_sqsybddjMxd == "")
                        {
                            MessageBox.Show("市区标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqsybddjMxd);//默认加载基准
                        m_currMxd = m_sqsybddjMxd;
                    }
                    this.mapViewer1.lblTips.Text = " 市区商业宗地价格按标定地价测算";

                    //这里我修改了配置文件，你需自己另外配置个配置文件
                    //MessageBox.Show("配置文件已修改，请另外新建配置文件");

                    //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layerName");//宗地图层名



                    //获取宗地图层名
                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业宗地']";
                    layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
                    CommonLib.AETools.tagetLayerName = layerName;
                    //获取样点图层
                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业样点']";
                    CommonLib.AETools.YDLayerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");

                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业宗地']/field[@name='标定地价']";
                    CommonLib.AETools.tagetLayerField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");//获取存放标定地价字段名

                    XmlNode = "mxds/mxd[@name='商业标定价']/layer[@name='商业宗地']/field[@name='出让价格']";
                    CommonLib.AETools.tagetCRJGField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");//获取存放出让地价字段名

                    List<string> syList = XMLConfig.getBDDJInfo("BDDJConfig.xml", "AppConfig/SY");
                    //CommonLib.AETools.YDLayerName = syList[0];//样点图层名
                    CommonLib.AETools.YDLayerField = syList[1];//样点图层标定地价字段名
                    CommonLib.AETools.RJLXZXS = syList[2];//样点图层修正系数
                    CommonLib.AETools.SYNQXZXS = syList[3];//样点图层修正系数
                    CommonLib.AETools.LJSDXZXS = syList[4];//样点图层修正系数
                    CommonLib.AETools.KSBXZXS = syList[5];//样点图层修正系数
                    CommonLib.AETools.ZDXZXZXS = syList[6];//样点图层修正系数
                    CommonLib.AETools.JJDXZXS = syList[7];//样点图层修正系数
                    CommonLib.AETools.KFCDXZXS = syList[8];//样点图层修正系数
                    CommonLib.AETools.EJFLXZXS = syList[9];//样点图层修正系数

                    CommonLib.CommonTools.MapMouseFlag = 30004;
                    this.mapViewer1.axMapControlMainMap.CurrentTool = null;
                    this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
                    #endregion
                    break;
                case "nbi_ZZ_CitySellPrice":
                    #region 住宅按标定
                    //将地图窗口的地图切换到市区标定地价mxd;
                    if (m_currMxd != m_sqzzbddjMxd)
                    {
                        if (m_sqsybddjMxd == "")
                        {
                            MessageBox.Show("市区标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqzzbddjMxd);//默认加载基准
                        m_currMxd = m_sqzzbddjMxd;
                    }
                    this.mapViewer1.lblTips.Text = " 市区商业宗地价格按标定地价测算";

                    //这里我修改了配置文件，你需自己另外配置个配置文件
                    //MessageBox.Show("配置文件已修改，请另外新建配置文件");

                    //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layerName");//宗地图层名



                    //获取宗地图层名
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅宗地']";
                    layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
                    CommonLib.AETools.tagetLayerName = layerName;


                    //获取样点图层
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅样点']";
                    CommonLib.AETools.YDLayerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");

                    //获取标定地价字段
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅宗地']/field[@name='标定地价']";
                    CommonLib.AETools.tagetLayerField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");

                    //获取出让地价字段
                    XmlNode = "mxds/mxd[@name='住宅标定价']/layer[@name='住宅宗地']/field[@name='出让价格']";
                    CommonLib.AETools.tagetCRJGField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");
                    //CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQZZBDData.Name, "layer");//宗地图层标定地价字段名

                    List<string> zzList = XMLConfig.getBDDJInfo("BDDJConfig.xml", "AppConfig/ZZ");
                    //CommonLib.AETools.YDLayerName = zzList[0];//样点图层名
                    CommonLib.AETools.YDLayerField = zzList[1];//样点图层标定地价字段名
                    CommonLib.AETools.RJLXZXS = zzList[2];//样点图层修正系数
                    CommonLib.AETools.SYNQXZXS = zzList[3];//样点图层修正系数
                    CommonLib.AETools.LJSDXZXS = zzList[4];//样点图层修正系数
                    CommonLib.AETools.KSBXZXS = zzList[5];//样点图层修正系数
                    CommonLib.AETools.ZDXZXZXS = zzList[6];//样点图层修正系数
                    CommonLib.AETools.JJDXZXS = zzList[7];//样点图层修正系数


                    CommonLib.CommonTools.MapMouseFlag = 30005;
                    this.mapViewer1.axMapControlMainMap.CurrentTool = null;
                    this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
                    #endregion
                    break;
                case "nbi_GY_CitySellPrice":
                    #region 工业按标定
                    //将地图窗口的地图切换到市区标定地价mxd;
                    if (m_currMxd != m_sqgybddjMxd)
                    {
                        if (m_sqgybddjMxd == "")
                        {
                            MessageBox.Show("市区标定地价地价数据未配置！");
                            return;
                        }
                        this.mapViewer1.LoadFile(m_sqgybddjMxd);//默认加载基准
                        m_currMxd = m_sqgybddjMxd;
                    }
                    //这里我修改了配置文件，你需自己另外配置个配置文件
                    //MessageBox.Show("配置文件已修改，请另外新建配置文件");

                    //CommonLib.AETools.tagetLayerName = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQSYBDData.Name, "layerName");//宗地图层名
                    CommonLib.AETools.tagetLayerField = m_DirPathConfig.GetAttributeValueFromSpcialAttribute("Path", "name", this.txtESQGYBDData.Name, "layer");//宗地图层标定地价字段名



                    //获取宗地图层名
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业宗地']";
                    layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
                    CommonLib.AETools.tagetLayerName = layerName;

                    //获取样点图层
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业样点']";
                    CommonLib.AETools.YDLayerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");

                    //获取标定地价字段
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业宗地']/field[@name='标定地价']";
                    CommonLib.AETools.tagetLayerField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");

                    //获取出让地价字段
                    XmlNode = "mxds/mxd[@name='工业标定价']/layer[@name='工业宗地']/field[@name='出让价格']";
                    CommonLib.AETools.tagetCRJGField = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "");

                    List<string> gyList = XMLConfig.getBDDJInfo("BDDJConfig.xml", "AppConfig/GY");
                    //CommonLib.AETools.YDLayerName = gyList[0];//样点图层名
                    CommonLib.AETools.YDLayerField = gyList[1];//样点图层标定地价字段名
                    CommonLib.AETools.RJLXZXS = gyList[2];//样点图层修正系数
                    CommonLib.AETools.SYNQXZXS = gyList[3];//样点图层修正系数
                    CommonLib.AETools.LJSDXZXS = gyList[4];//样点图层修正系数



                    CommonLib.CommonTools.MapMouseFlag = 30006;
                    this.mapViewer1.axMapControlMainMap.CurrentTool = null;
                    this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
                    #endregion
                    break;
            }
            this.mapViewer1.axMapControlMainMap.CurrentTool = null;
            this.mapViewer1.axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状
        }
        #endregion

        #region 更新
        /// <summary>市区商业基准地价更新
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_SY_JZDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            try
            {
	            this.mapViewer1.lblTips.Text = " 市区商业基准地价更新";
	            //将地图窗口的地图切换到市区标定地价mxd;
	            if (m_currMxd != m_sqsydjMxd)
	            {
	                if (m_sqsydjMxd == "")
	                {
	                    MessageBox.Show("市区商业基准地价数据未配置！");
	                    return;
	                }
	                this.mapViewer1.LoadFile(m_sqsydjMxd);//默认加载基准
	                m_currMxd = m_sqsydjMxd;
	            }
	            IFeatureLayer pFeatureLayer = new FeatureLayerClass();
	
	            //pFeatureLayer = AETools.GetFeatureLayer(this.mapViewer1.axMapControlMainMap, "基准地价", 0);
	            string XmlNode = "mxds/mxd[@name='商业级别价']/layer[@name='商业宗地']";
	            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
	            pFeatureLayer = AETools.GetFeatureLayer(this.mapViewer1.axMapControlMainMap, layerName);
	            CommonLib.FormStyle.OpenForm(this, new FormLib.DJUpdate("市区商业基准地价更新", pFeatureLayer), true);
            }
            catch (System.Exception ex)
            {
                COM.LIB.LOG.LogOperator.WriteLog(ex.Message);
            }
        }
        /// <summary>市区住宅基准地价更新
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_ZZ_JZDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            try
            {
	            this.mapViewer1.lblTips.Text = " 市区住宅基准地价更新";
	            //将地图窗口的地图切换到市区标定地价mxd;
	            if (m_currMxd != m_sqzzdjMxd)
	            {
	                if (m_sqzzdjMxd == "")
	                {
	                    MessageBox.Show("市区住宅基准地价数据未配置！");
	                    return;
	                }
	                this.mapViewer1.LoadFile(m_sqzzdjMxd);//默认加载基准
	                m_currMxd = m_sqzzdjMxd;
	            }
	            IFeatureLayer pFeatureLayer = new FeatureLayerClass();
	
	           // pFeatureLayer = AETools.GetFeatureLayer(this.mapViewer1.axMapControlMainMap, "基准地价", 0);
	            string XmlNode = "mxds/mxd[@name='住宅级别价']/layer[@name='住宅宗地']";
	            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
	            pFeatureLayer = AETools.GetFeatureLayer(this.mapViewer1.axMapControlMainMap, layerName);
	            CommonLib.FormStyle.OpenForm(this, new FormLib.DJUpdate("市区住宅基准地价更新", pFeatureLayer), true);
            }
            catch (System.Exception ex)
            {
                COM.LIB.LOG.LogOperator.WriteLog(ex.Message);
            }
        }
        /// <summary>市区工业基准地价更新
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void nbi_GY_JZDJ_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            try
            {
	            this.mapViewer1.lblTips.Text = " 市区工业基准地价更新";
	            //将地图窗口的地图切换到市区标定地价mxd;
	            if (m_currMxd != m_sqgydjMxd)
	            {
	                if (m_sqgydjMxd == "")
	                {
	                    MessageBox.Show("市区工业基准地价数据未配置！");
	                    return;
	                }
	                this.mapViewer1.LoadFile(m_sqgydjMxd);//默认加载基准
	                m_currMxd = m_sqgydjMxd;
	            }
	            IFeatureLayer pFeatureLayer = new FeatureLayerClass();
	
	            //pFeatureLayer = AETools.GetFeatureLayer(this.mapViewer1.axMapControlMainMap, "基准地价", 0);
	            //获取宗地图层名
	            string XmlNode = "mxds/mxd[@name='工业级别价']/layer[@name='工业宗地']";
	            string layerName = XMLConfig.getLayerByMXDAndLayerConfig("MXDAndLayerConfig.xml", XmlNode, "value");
	            pFeatureLayer = AETools.GetFeatureLayer(this.mapViewer1.axMapControlMainMap, layerName);
	            CommonLib.FormStyle.OpenForm(this, new FormLib.DJUpdate("市区工业基准地价更新", pFeatureLayer), true);
            }
            catch (System.Exception ex)
            {
                COM.LIB.LOG.LogOperator.WriteLog(ex.Message);
            }
        }
        #endregion

        #region 数据配置

        private void sBtnHandle_Click(object sender, EventArgs e)//添加字段
        {
            this.rtbFieldResult.Text = "";
            string layerName = chsNamePairLayerDic[this.cmbLayer.SelectedItem.ToString()];
            //选择图层要将mxd文件加载到mapcontrol中，否则可能会有加载不到图层数据的情况。
            switch (this.cmbLayer.SelectedItem.ToString())
            {
                case "市区商业基准地价数据":
                    swithMap(m_currMxd, m_sqsydjMxd, "市区商业基准地价数据");
                    break;
                case "市区住宅基准地价数据":
                    swithMap(m_currMxd, m_sqzzdjMxd, "市区住宅基准地价数据");
                    break;
                case "市区工业基准地价数据":
                    swithMap(m_currMxd, m_sqgydjMxd, "市区工业基准地价数据");
                    break;
                case "市区商业标定地价数据":
                    swithMap(m_currMxd, m_sqsybddjMxd, "市区商业标定地价数据");
                    break;
                case "市区商业路线地价数据":
                    swithMap(m_currMxd, m_sqsylxdjMxd, "市区商业路线地价数据");
                    break;
                case "合水镇地价数据":
                    swithMap(m_currMxd, m_hszdjMxd, "合水镇地价数据");
                    break;
                case "怀乡镇地价数据":
                    swithMap(m_currMxd, m_hxzdjMxd, "怀乡镇地价数据");
                    break;
                case "镇隆镇地价数据":
                    swithMap(m_currMxd, m_zlzdjMxd, "镇隆镇地价数据");
                    break;
                case "其他乡镇地价数据":
                    swithMap(m_currMxd, m_otherdjMxd, "其他乡镇地价数据");
                    break;
                case "市区住宅标定地价数据":
                    swithMap(m_currMxd, m_sqzzbddjMxd, "市区住宅标定地价数据");
                    break;
                case "市区工业标定地价数据":
                    swithMap(m_currMxd, m_sqgybddjMxd, "市区工业标定地价数据");
                    break;
                default:
                    return;
            }
            CommonLib.XMLConfig fieldHandleConfig = new CommonLib.XMLConfig("FieldConfig.xml");
            List<string> name = fieldHandleConfig.GetAttributeValueListFromNodeName("layer", "name", layerName, "field", "name");
            List<string> aliasname = fieldHandleConfig.GetAttributeValueListFromNodeName("layer", "name", layerName, "field", "aliasname");
            List<bool> fieldOprate = new List<bool>();
            FieldPrePrc fieldHandle = new FieldPrePrc(this.mapViewer1.axMapControlMainMap, fieldHandleConfig);
            fieldOprate = fieldHandle.setFieldsByLayerName(layerName);
            string resultMsg = "";
            if (fieldOprate[0] == true)
            {
                resultMsg = "字段" + name[0] + "[" + aliasname[0] + "] 添加成功";
            }
            else
            {
                resultMsg = "字段" + name[0] + "[" + aliasname[0] + "] 添加失败：字段已存在";
            }
            for (int i = 1; i < name.Count; i++)
            {
                if (fieldOprate[i] == true)
                {
                    resultMsg += "|| 字段" + name[i] + "[" + aliasname[i] + "] 添加成功";
                }
                else
                {
                    resultMsg += "|| 字段" + name[i] + "[" + aliasname[i] + "] 添加失败：字段已存在";
                }
            }
            //this.lblHandleResult.Text = "处理结果: " + resultMsg;
            this.rtbFieldResult.Text = resultMsg;
        }

        private void sBtnSelectSQJZMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市商业基准地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQSYData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectSQZZMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市住宅基准地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQZZData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectSQGYMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市工业基准地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQGYData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectSYBDMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市商业标定地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQSYBDData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectZZBDMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市住宅标定地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQZZBDData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectGYBDMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市工业标定地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQGYBDData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectSQSYLXMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市商业路线地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtESQSYLXData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectHSZMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市合水镇地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtEHSZData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectHXZMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市怀乡镇地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtEHXZData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectZLZMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市镇隆镇地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtEZLZData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnSelectOtherMxd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = true;
            ofd.Title = "选择信宜市其他乡镇地价工程数据";
            ofd.Filter = "地图工程文件(*.mxd)|*.mxd|所有数据(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.txtEOtherData.Text = ofd.FileName;
            }
            else return;
        }

        private void sBtnOK_Click(object sender, EventArgs e)
        {
            if (txtESQSYData.Text.Trim().Equals("") || txtESQZZData.Text.Trim().Equals(""))
            {
                MessageBox.Show("请选择与系统相关的数据！");
                return;
            }
            else
            {
                try
                {
                    //List<string> pathMxdTypeList = new List<string>();
                    List<KeyValuePair<string, string>> pathMxdTypeList = new List<KeyValuePair<string, string>>();
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQSYData.Name, "市区商业基准地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQZZData.Name, "市区住宅基准地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQGYData.Name, "市区工业基准地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQSYBDData.Name, "市区商业标定地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQSYLXData.Name, "市区商业路线地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtEHSZData.Name, "合水镇地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtEHXZData.Name, "怀乡镇地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtEZLZData.Name, "镇隆镇地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtEOtherData.Name, "其他乡镇地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQZZBDData.Name, "市区住宅标定地价数据"));
                    pathMxdTypeList.Add(new KeyValuePair<string, string>(this.txtESQGYBDData.Name, "市区工业标定地价数据"));
                    List<string> pathMxdValueList = new List<string>();
                    List<string> pathMxdLayerList = new List<string>();
                    pathMxdValueList.Add(this.txtESQSYData.Text);
                    pathMxdValueList.Add(this.txtESQZZData.Text);
                    pathMxdValueList.Add(this.txtESQGYData.Text);
                    pathMxdValueList.Add(this.txtESQSYBDData.Text);
                    pathMxdValueList.Add(this.txtESQSYLXData.Text);
                    pathMxdValueList.Add(this.txtEHSZData.Text);
                    pathMxdValueList.Add(this.txtEHXZData.Text);
                    pathMxdValueList.Add(this.txtEZLZData.Text);
                    pathMxdValueList.Add(this.txtEOtherData.Text);
                    pathMxdValueList.Add(this.txtESQZZBDData.Text);
                    pathMxdValueList.Add(this.txtESQGYBDData.Text);
                    pathMxdLayerList.Add("基准地价");
                    pathMxdLayerList.Add("基准地价");
                    pathMxdLayerList.Add("基准地价");
                    pathMxdLayerList.Add("BDDJ");
                    pathMxdLayerList.Add("Price");
                    pathMxdLayerList.Add("Name");
                    pathMxdLayerList.Add("Name");
                    pathMxdLayerList.Add("Name");
                    pathMxdLayerList.Add("Name");
                    pathMxdLayerList.Add("BDDJ");
                    pathMxdLayerList.Add("BDDJ");
                    m_DirPathConfig.AddDirPathInfo("Path", pathMxdTypeList, pathMxdValueList, pathMxdLayerList);
                    m_currMxd = this.txtESQSYData.Text;
                    MessageBox.Show("保存成功！");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存失败！");
                    COM.LIB.LOG.LogOperator.WriteLog(ex.Message);
                }

            }
        }
        #endregion

        #region 系统设置
        private void checkEdit07Blue_CheckedChanged(object sender, EventArgs e)
        {
            if ((sender as CheckEdit).Checked)
            {
                if ((sender as CheckEdit).Text.Equals("Office 2007 蓝色"))
                {
                    this.defaultLookAndFeel1.LookAndFeel.SkinName = "Office 2007 Blue";
                }
                if ((sender as CheckEdit).Text.Equals("Office 2007 绿色"))
                {
                    this.defaultLookAndFeel1.LookAndFeel.SkinName = "Office 2007 Green";
                }
                if ((sender as CheckEdit).Text.Equals("Office 2010 蓝色"))
                {
                    this.defaultLookAndFeel1.LookAndFeel.SkinName = "Office 2010 Blue";
                }
                if ((sender as CheckEdit).Text.Equals("Office 2010 银色"))
                {
                    this.defaultLookAndFeel1.LookAndFeel.SkinName = "Office 2010 Silver";
                }
                if ((sender as CheckEdit).Text.Equals("浅褐色"))
                {
                    this.defaultLookAndFeel1.LookAndFeel.SkinName = "Caramel";
                }
                m_cumtomXMLreadConfig.SetCustomSkin((sender as CheckEdit).Text);
            }
        }

        private void sBtnHelp_Click(object sender, EventArgs e)
        {
            try
            {
                //KillAlWordProcess();
                string pReportModulePathName = System.Windows.Forms.Application.StartupPath.Substring(0, System.Windows.Forms.Application.StartupPath.LastIndexOf("\\bin")) +
                                           "\\Help\\农用地产能核算系统用户帮助手册.chm";
                if (!File.Exists(pReportModulePathName))
                {
                    MessageBox.Show("所选文档不存在！");
                    return;
                }
                Process.Start("explorer.exe", pReportModulePathName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        #endregion

        //方法切换地图
        private void swithMap(string currentMap, string targetMap,string targetMapName)
        {
            if (currentMap != targetMap)
            {
                if (targetMap == "")
                {
                    MessageBox.Show(targetMapName+"未配置！");
                    return;
                }
                this.mapViewer1.LoadFile(targetMap);//默认加载基准
                currentMap = targetMap;
            }

        }

        private void cmbLayer_SelectedValueChanged(object sender, EventArgs e)
        {
            this.rtbFieldResult.Text = "";
        }

    }
}